<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>找回密码</title>
<link href="${pageContext.request.contextPath}/css/common.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/css/register.css" rel="stylesheet" type="text/css" />
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
	function checkForm() {
		//校验用户名不能为空
		var username = document.getElementById("username").value;
		if (username == null || username == '') {
			alert("用户名不能为空");
			return false;
		}
		return true;
	}
	function checkUsername(){

		$.ajax({
			url:"${pageContext.request.contextPath}/checkFindByid.action",
			method:"post",
			data:{
				"username":$("#username").val()
			},
			success:function(response){
				console.log(response);
				let $checkuser=response.objectMap.checkuser;
				if(response.errorCode==="100"){
					$("#span1").text($checkuser).attr("style","color:green;");
				}else{
					$("#span1").text($checkuser).attr("style","color:red;");
				}
			},
			error:function(){
				console.log("请求发送失败..")
			}
		});
	}
	function creatXMLHttpreauest() {
		try {
			return new XMLHttpRequest();
		} catch (e) {
			try {
				return ActiveXObject("Msxml2.XMLHttp");
			} catch (e) {
				try {
					return ActiveXObject("micoresoftxml2.XMLHttp");
				} catch (e) {
					throw e;
				}
			}
		}
	}
	function change(){
		var img = document.getElementById("checkImg");
		img.src="${pageContext.request.contextPath}/checkImg.action?"+new Date();
	}
</script>
</head>
<body>
	<div class="container header">
		<div class="span5">
			<div class="logo">
				<a href="${pageContext.request.contextPath}/index.action"> <img
					src="${pageContext.request.contextPath}/image/r___________renleipic_01/logo.gif"
					alt=""></a>
			</div>
		</div>
		<div class="span9">
			
		</div>
		<%@ include file="menu.jsp"%>

	</div>
	<div class="container register">
		<div class="span24">
			<div class="wrap">
				<div class="main clearfix">
					<div class="title">
						<strong>找回密码</strong>RETRIEVE PASSWORD
					</div>
					<c:if test="${errors!=null}">
						<c:forEach items="${errors}" var="error">
							${error}
						</c:forEach>
					</c:if>
					<form id="registerForm" method="post"
						action="${pageContext.request.contextPath}/findQuestionByUsername.action"
						>
						<table>
							<tbody>
								<tr>
									<th><span class="requiredField">*</span>用户名:</th>
									<td><input type="text" id="username" name="username"
										class="text" maxlength="20" onblur="checkUsername()">
											<span id="span1"></span></td>
								</tr>
								<tr>
									<th><span class="requiredField">*</span>验证码:</th>
									<td>
										<span class="fieldSet"> 
										<input type="text" id="captcha" name="checkImg" class="text captcha" maxlength="4" autocomplete="off">
										<img id="checkImg" class="captchaImage" src="${pageContext.request.contextPath}/checkImg.action"
													title="点击更换验证码" onclick="change()">
										</span>
									</td>
								</tr>
								<tr>
									<th>&nbsp;</th>
									<td><input type="submit" class="submit" value="确定用户名">&nbsp;<span style="color:red;">${messageUser}&nbsp;</span></td>
								</tr>
								
							</tbody>
						</table>
						
					</form>
				</div>
			</div>
		</div>
	</div>
	<div class="container footer">
		<div class="span24">
			
		</div>
		<div class="span24">
			<ul class="bottomNav">
				<li><hr></hr></li>
			</ul>
		</div>
		<div class="span24">
			<div class="copyright">Copyright ©  网上商城 版权所有</div>
		</div>
	</div>
	<div id="_my97DP"
		style="position: absolute; top: -1970px; left: -1970px;">
		
	</div>
</body>
</html>